﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.IO;
namespace LuxDiner.Model
{
    public class MBase
    {
        /// <summary>
        /// 将类序列化为字符串
        /// </summary>
        /// <returns></returns>
        public virtual string Serialize()
        {
            if (this != null)
            {
                XmlSerializer xmls = new XmlSerializer(this.GetType());
                StringWriter sw = new StringWriter();
                xmls.Serialize(sw, this);
                return sw.ToString();
            }
            else
                return null;
        }
    }
}
